package com.suncaper.han_yi_system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.suncaper.han_yi_system.pojo.dto.UserQueryDto;
import com.suncaper.han_yi_system.pojo.entity.Role;
import com.suncaper.han_yi_system.pojo.entity.User;
import com.suncaper.han_yi_system.pojo.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    List<Role> findRoleByUserId(Long id);

    Page<UserVo> pageList(@Param("page") Page<UserVo> page, @Param("user") UserQueryDto userQueryDto);

    List<UserVo> findUserByRole();

    UserVo findCurrentUser(@Param("userId") Long userId);

    void insertUserRole(@Param("userId") Long userId, @Param("roleId") Long roleId);

    void deleteUserRole(@Param("userId") Long userId);
}